package com.hs.lin.controller;

import com.hs.dto.ResultBean;
import com.hs.lin.pojo.ExceptionRegistration;
import com.hs.lin.service.IExceptionRegistrationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lin GongZi
 * @since 2022-06-13
 */
@RestController
@CrossOrigin
@RequestMapping("/exceptionRegistration")
@Api(tags = "在途追踪测试")
public class ExceptionRegistrationController {

    @Autowired
    private IExceptionRegistrationService exceptionRegistrationService;

    /**
     * 页面展示加分页加条件查询测试
     * @return
     */
    @GetMapping
    public ResultBean list(Integer currentPage, Integer pageSize,String exId,String oId,String cId,String exceptionType){
        return exceptionRegistrationService.findPage(currentPage,pageSize,exId,oId,cId,exceptionType);
    }

    /**
     * 异常登记方法
     * @return
     */
    @ApiOperation(value = "异常登记测试")
    @PostMapping
    public ResultBean registrationEx(@RequestBody ExceptionRegistration exceptionRegistration){
        return exceptionRegistrationService.registrationEx(exceptionRegistration);
    }

    /**
     * 根据异常单号查询
     * @return
     */
    @GetMapping("/all")
    public ExceptionRegistration queryById(String id){
        return exceptionRegistrationService.queryById(id);
    }

    /**
     * 根据派车单号查询
     * @param
     * @return
     */
    @GetMapping("/ById")
    public ResultBean findById(String id,String cId,String oId){
        return exceptionRegistrationService.findById(id,cId,oId);
    }


}
